From: akw@devbox.site Date: Tue, 29 Aug 2006 21:34:57 +0000 (-0700) Subject: Reduce AIO context allocations in blktap. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15673^2~23^2~10 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=8c6d286668037e1eccd13ff32dd07ee1ba872591;p=xen.git Reduce AIO context allocations in blktap. Signed-off-by: Andrew Warfield --- diff --git a/tools/blktap/drivers/block-aio.c b/tools/blktap/drivers/block-aio.c index ebcfc35f56..48307faef5 100644 --- a/tools/blktap/drivers/block-aio.c +++ b/tools/blktap/drivers/block-aio.c @@ -52,7 +52,7 @@ */ #define REQUEST_ASYNC_FD 1 -#define MAX_AIO_REQS (MAX_REQUESTS * MAX_SEGMENTS_PER_REQ * 8) +#define MAX_AIO_REQS (MAX_REQUESTS * MAX_SEGMENTS_PER_REQ) struct pending_aio { td_callback_t cb; @@ -146,7 +146,7 @@ int tdaio_open (struct td_state *s, const char *name) struct tdaio_state *prv = (struct tdaio_state *)s->private; s->private = prv; - DPRINTF("XXX: block-aio open('%s')", name); + DPRINTF("block-aio open('%s')", name); /* Initialize AIO */ prv->iocb_free_count = MAX_AIO_REQS; prv->iocb_queued = 0; @@ -156,9 +156,18 @@ int tdaio_open (struct td_state *s, const char *name) if (prv->poll_fd < 0) { ret = prv->poll_fd; - DPRINTF("Couldn't get fd for AIO poll support. This is " - "probably because your kernel does not have the " - "aio-poll patch applied.\n"); + if (ret == -EAGAIN) { + DPRINTF("Couldn't setup AIO context. If you are " + "trying to concurrently use a large number " + "of blktap-based disks, you may need to " + "increase the system-wide aio request limit. " + "(e.g. 'echo echo 1048576 > /proc/sys/" + "aio-max-nr')\n"); + } else { + DPRINTF("Couldn't get fd for AIO poll support. This " + "is probably because your kernel does not " + "have the aio-poll patch applied.\n"); + } goto done; } diff --git a/tools/blktap/drivers/block-qcow.c b/tools/blktap/drivers/block-qcow.c index 7eab8c9834..d586534161 100644 --- a/tools/blktap/drivers/block-qcow.c +++ b/tools/blktap/drivers/block-qcow.c @@ -51,7 +51,7 @@ /******AIO DEFINES******/ #define REQUEST_ASYNC_FD 1 #define MAX_QCOW_IDS 0xFFFF -#define MAX_AIO_REQS (MAX_REQUESTS * MAX_SEGMENTS_PER_REQ * 8) +#define MAX_AIO_REQS (MAX_REQUESTS * MAX_SEGMENTS_PER_REQ) struct pending_aio { td_callback_t cb; @@ -176,10 +176,21 @@ static int init_aio_state(struct td_state *bs) s->aio_ctx = (io_context_t) REQUEST_ASYNC_FD; s->poll_fd = io_setup(MAX_AIO_REQS, &s->aio_ctx); - if (s->poll_fd < 0) { - DPRINTF("Retrieving Async poll fd failed\n"); + if (s->poll_fd < 0) { + if (s->poll_fd == -EAGAIN) { + DPRINTF("Couldn't setup AIO context. If you are " + "trying to concurrently use a large number " + "of blktap-based disks, you may need to " + "increase the system-wide aio request limit. " + "(e.g. 'echo echo 1048576 > /proc/sys/" + "aio-max-nr')\n"); + } else { + DPRINTF("Couldn't get fd for AIO poll support. This " + "is probably because your kernel does not " + "have the aio-poll patch applied.\n"); + } goto fail; - } + } for (i=0;iiocb_free[i] = &s->iocb_list[i];